package com.cat.iterator;

/**
 * @author cat
 * @version 2025/5/27 20:16
 * @description
 * @since JDK17
 */

public class Client {
    public static void main(String[] args) {
        StudentAggregateImpl studentAggregate = new StudentAggregateImpl();

        studentAggregate.addStudent(new Student("jcjc", 19));
        studentAggregate.addStudent(new Student("yjyj", 18));
        studentAggregate.addStudent(new Student("ynyn", 17));

        // 遍历聚合对象
        StudentIterator iterator = studentAggregate.getStudentIterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }

    }
}
